﻿CREATE TABLE [dbo].[WxPayRefundLog] (
    [Id]              INT            IDENTITY (1, 1) NOT NULL,
	[Partner] NVARCHAR (50) NULL,
	[TransactionId]         NVARCHAR (50)  NULL,
    [OutTradeNo]         NVARCHAR (50)  NULL,
	[OutRefundNo] NVARCHAR (50)  NULL,
	[RefundId]         NVARCHAR (50)  NULL,
	[RefundChannel]   NVARCHAR (50)  NULL,
	[RefundFee]       INT            NULL,
	[RefundStatus]       INT            NULL,
    [RecvUserId]        NVARCHAR(100)            NULL,
    [RecvUserName]        NVARCHAR (50)  NULL,
    [RecCreateDt] DATETIME NULL, 
    CONSTRAINT [PK_WxPayRefundLog] PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Id 主键 自增长' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name=N'Id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商户订单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name='OutTradeNo'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'接收人帐号,转账退款接收退款的财付通帐号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name='RecvUserId'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'接收人姓名,转账退款接收退款的姓名(需与接收退款的财付通帐号绑定的姓名一致)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name='RecvUserName'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商户退款单号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name='OutRefundNo'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'退款状态 4，10：退款成功。 3，5，6：退款失败。8，9，11：退款处理中 1，2：未确定，需要商户原退款单号重新发起。 7：转入代发，退款到银行发现用户的卡作废或者冻结了，导致原路退款银行卡失败，资金回流到商户的现金帐号，需要商户人工干预，通过线下或者财付通转账的方式进行退款。' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name=N'RefundStatus'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'退款渠道 0 财付通 1  银行' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name=N'RefundChannel'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'退款总金额,单位为分,可以做部分退款' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WxPayRefundLog', @level2type=N'COLUMN',@level2name=N'RefundFee'
GO


EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'商户号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'WxPayRefundLog',
    @level2type = N'COLUMN',
    @level2name = N'Partner'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'财付通订单号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'WxPayRefundLog',
    @level2type = N'COLUMN',
    @level2name = N'TransactionId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'财付通退款单号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'WxPayRefundLog',
    @level2type = N'COLUMN',
    @level2name = N'RefundId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'记录创建时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'WxPayRefundLog',
    @level2type = N'COLUMN',
    @level2name = N'RecCreateDt'